package com.hmy.finance.dal.po;

import com.baomidou.mybatisplus.annotation.*;
import com.hmy.finance.common.enums.PaymentStatusEnum;
import com.hmy.finance.dal.po.json.ProfitLossInfoJson;
import com.hmy.finance.dal.po.json.ProfitLossInfoJsonHandler;
import lombok.Data;
import org.apache.ibatis.type.EnumTypeHandler;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 合同日费用流水
 *
 * @author songkf
 * @TableName contract_daily_bill
 */
@TableName(value = "contract_daily_bill", autoResultMap = true)
@Data
public class ContractDailyBillPo implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 3962930646713133419L;
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 客户ID
     */
    @TableField(value = "customer_id")
    private Long customerId;

    /**
     * 合同ID
     */
    @TableField(value = "contract_id")
    private Long contractId;

    /**
     * 日租金费用
     */
    @TableField(value = "daily_fee")
    private BigDecimal dailyFee;

    /**
     * 月租金费用
     */
    @TableField(value = "monthly_fee")
    private BigDecimal monthlyFee;

    /**
     * 租金费用
     */
    @TableField(value = "fee")
    private BigDecimal fee;

    /**
     * 损益总金额
     */
    @TableField(value = "total_profit_loss_amount")
    private BigDecimal totalProfitLossAmount;

    /**
     * 总账单-已对账总金额
     */
    @TableField(value = "history_reconciled_amount")
    private BigDecimal historyReconciledAmount;

    /**
     * 损益详细信息
     */
    @TableField(value = "profit_loss_info", typeHandler = ProfitLossInfoJsonHandler.class)
    private List<ProfitLossInfoJson> profitLossInfo;

    /**
     * 未对账总金额
     */
    @TableField(value = "total_unreconciled_amount")
    private BigDecimal totalUnreconciledAmount;

    /**
     * 已对账总金额
     */
    @TableField(value = "total_reconciled_amount")
    private BigDecimal totalReconciledAmount;

    /**
     * 总营收
     */
    @TableField(value = "total_revenue_amount")
    private BigDecimal totalRevenueAmount;

    /**
     * 回款金额
     */
    @TableField(value = "total_payment_amount")
    private BigDecimal totalPaymentAmount;

    /**
     * 回款标识 (1-未回款, 2-部分回款, 3-已回款)
     */
    @TableField(value = "payment_status", typeHandler = EnumTypeHandler.class)
    private PaymentStatusEnum paymentStatus;

    /**
     * 费用发生日期
     */
    @TableField(value = "fee_incurred_time")
    private LocalDateTime feeIncurredTime;
    @TableLogic
    private Boolean isDeleted;
}